"use strict";
cc._RF.push(module, '3479d0y2TtLFom7ScGAqe3j', 'hall');
// scripts/scenes/hall.ts

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var gameConfig_1 = require("../engines/configs/gameConfig");
var gameEngine_1 = require("../engines/gameEngine");
var gameMode_json_1 = require("../engines/managers/gameContent/gameMode_json");
var userInterface_1 = require("../engines/services/userContent/userInterface");
var Enum_1 = require("../Game/Enum");
var MainRoot_1 = require("../Game/MainRoot");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var hall = /** @class */ (function (_super) {
    __extends(hall, _super);
    function hall() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.isClickMenu = false;
        return _this;
    }
    hall.prototype.onLoad = function () {
        // console.log('<hall> 场景', cc.sys.platform);;
        gameEngine_1.managers().soundMgr.playMusic("mainSound/bgm");
        gameEngine_1.services().miniGameSrv.getAppApiInstance().gameRecordStop();
        gameEngine_1.default.getServices().userSrv.setCoins(0, false);
        // if(!O1HD.getServices().miniGameSrv.getAppApiInstance().isProduction()){
        //     O1HD.getServices().userSrv.setCoins(999,false);
        // }
        // if(O1HD.getServices().userSrv.getFirstLogin() != "1"){
        //     // 打开每日送免广告币
        //     O1HD.getServices().userSrv.setFirstLogin(1);
        //     mainRoot.UISystem.OpenPage(PAGE.DAILYBONUSPAGE);
        //     O1HD.getServices().userSrv.setLastLoginDate();
        // }
        gameEngine_1.default.getManagers().goldMinerManager.resetProp();
        gameEngine_1.default.getManagers().peopleArcheryManager.loadConfig();
    };
    hall.prototype.onBtnStart = function (e, custom) {
        var mode = Number(custom);
        if (gameEngine_1.services().userSrv.getPower() - gameConfig_1.default.MODE_POWER[mode] < 0) {
            gameEngine_1.modules().uiControlModule.showUserPropGet(userInterface_1.REWARD_TYPE.POWER, gameConfig_1.default.ADD_ONCE_POWER);
            return;
        }
        // console.log("包名");
        // console.warn('重置7');
        MainRoot_1.default.GotTips = false;
        MainRoot_1.default.GotAnswer = false;
        var bundleName = MainRoot_1.default.LevelSystem.GetSignleLevelInfo(mode).bundleName;
        gameEngine_1.services().userSrv.setPower(-gameConfig_1.default.MODE_POWER[mode], true, true);
        MainRoot_1.default.LevelSystem.LoadLevel(bundleName, mode);
    };
    hall.prototype.onBtnStartLevel = function (e, custom) {
        var mode = Number(custom);
        MainRoot_1.default.GotTips = false;
        MainRoot_1.default.GotAnswer = false;
        var levelIndex = MainRoot_1.default.LevelSystem.GetCurrLevel(mode);
        MainRoot_1.default.LevelSystem.LoadLevel(MainRoot_1.default.LevelSystem.GetSignleLevelInfo(mode, levelIndex).bundleName, mode, levelIndex);
    };
    hall.prototype.OnBtnLevelMenu = function (e, custom) {
        var _this = this;
        if (this.isClickMenu)
            return;
        this.isClickMenu = true;
        gameEngine_1.managers().soundMgr.playSound("mainSound/anNiu");
        this.scheduleOnce(function () {
            _this.isClickMenu = false;
        }, 1);
        var mode = Number(custom);
        switch (mode) {
            case gameMode_json_1.GAME_MODE.NORMAL: {
                gameEngine_1.default.getManagers().peopleArcheryManager.loadConfig().then(function () {
                    MainRoot_1.default.UISystem.OpenPage(Enum_1.PAGE.PEOPLE_ARCHERY_START_PAGE);
                });
                break;
            }
            default: {
                var levelMenuPrams = {
                    mode: mode
                };
                MainRoot_1.default.UISystem.OpenPage(Enum_1.PAGE.LEVELMENU, levelMenuPrams);
                break;
            }
        }
    };
    // OnBtnNewestLevelMenu(e, custom: string) {
    //     if (this.isClickMenu) return;
    //     this.isClickMenu = true;
    //     this.scheduleOnce(() => {
    //         this.isClickMenu = false;
    //     }, 0.2);
    //     const mode = Number(custom);
    //     let levelMenuPrams = {
    //         mode: mode
    //     }
    //     mainRoot.UISystem.OpenPage(PAGE.LEVELMENU, levelMenuPrams);
    // }
    hall.prototype.onBtnRank = function () {
        gameEngine_1.managers().soundMgr.playSound('mainSound/anNiu');
        gameEngine_1.managers().soundMgr.playVibrate();
        gameEngine_1.default.getServices().miniGameSrv.getAppApiInstance().showRank();
    };
    hall.prototype.OnBtnInfinity = function () {
        gameEngine_1.managers().soundMgr.playSound('mainSound/anNiu');
        gameEngine_1.modules().uiControlModule.showInfinityPower(1, null);
    };
    hall.PlatFrom = ""; //平台信息
    hall = __decorate([
        ccclass
    ], hall);
    return hall;
}(cc.Component));
exports.default = hall;

cc._RF.pop();